{extends file="../home.html"}
{block name="title"}{$head_title}{/block}

{block name="css"}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/front/front_css/refresh_load.css?version={$version}"/>
<link rel="stylesheet" type="text/css" href="/Public/Css/front/front_css/recharge_pay_pop.css">

{if $opt == 'praise'}
<link href="__PUBLIC__/Css/front/css/zanshang_detail.css?version={$version}" type="text/css" rel="stylesheet">
{elseif $opt == 'reward'}
<link href="__PUBLIC__/Css/front/css/xuanshang_detail.css?version={$version}" type="text/css" rel="stylesheet">
<link href="__PUBLIC__/Css/front/css/xuanshang_lz.css?version={$version}" type="text/css" rel="stylesheet">
{elseif $opt == 'crowdfunding'}
<link href="__PUBLIC__/Css/front/css/zhonchou_detail.css?version={$version}" type="text/css" rel="stylesheet">
<link href="__PUBLIC__/Css/front/css/louzhu.css?version={$version}" type="text/css" rel="stylesheet">
{else}
<link href="__PUBLIC__/Css/front/css/common_tiezi.css?version={$version}" type="text/css" rel="stylesheet">
{/if}
<style type="text/css">

/*全屏查看器样式*/
.fullscreen{
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	z-index: 10000;
	background-color: #000;
	display: none;
}
.fullscreen .fullscreen_slide{
	background-color: #000;
}
/*密码框*/
#pwd_box{
	width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    position: fixed;
    display: block;
    top: 0;
    z-index: 1001;
	display: none;
}
#pwd_box .pop_back{
	width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    position: fixed;
    display: block;
    top: 0;
    z-index: 1001;
}
#pwd_box .pwd_pop{
	width: 100%;
    height: 10rem;
    position: absolute;
    bottom: 0;
    z-index: 1001;
    background-color: #fff;
}
.pwd_detail{
	width: 100%;
    height: 2.5rem;
    line-height: 2.5rem;
    font-size: 0.9rem;
    color: #323232;
    text-align: center;
    border-bottom: 0.05rem solid #E1E1E1;;
}
.close_pwd {
    background-image: url(/Public/Images/front/front_img/icon_sign_close.png);
    width: 1.1rem;
    height: 1.1rem;
    background-size: 1.1rem 1.1rem;
    position: absolute;
    top: 0.7rem;
    left: 3.2%;
}
.input_box{
	width: 17.1rem;
	margin:.75rem auto;
	position: relative;
	height: 2.3rem;
}

.dot{
	width: 2.875rem;
    height: 2.3rem;
    border: 0.05rem solid #efefef;
    position: absolute;
    top:0;
    left: 0;
    background-color: #fff;
    box-sizing: border-box;
    border-right: 0;
}
.dot::after{
	content: "";
	width: 0.4rem;
    height: .4rem;
    border-radius: 50%;
    display: block;
    background-color: #000;
    position: absolute;
    top:0;
    right: 0;
    bottom: 0;
    left:0;
    margin: auto;
    display: none;
}
.dot.show::after{
	display: block;
}
.dot_1{
	left:0;
}
.dot_2{
	left: 2.875rem;
}
.dot_3{
	left: 5.75rem;
}	
.dot_4{
	left:8.625rem;
}
.dot_5{
	left: 11.5rem;
}
.dot_6{
	left:14.375rem;
	border-right: 1px solid #efefef;
}
.input_box input{
	width: 150%;
	height: 2.3rem;
	position: absolute;
	left: 0;
	top:0;
	background: transparent;
	z-index: 10;
	color: transparent;
	text-indent: -999px;
	margin-left: -50%;
	line-height: 0;
}
.forget_pwd{
	width: 17.1rem;
	margin: auto;
	font-size: .65rem;
	line-height: .9rem;
	color: #4A90E2;
	text-align: right;
}
.forget_pwd a{
	color: #4A90E2;
}

.user_comment .at{
	color:#3385ff;
}

/*删除提示框*/
.confirm_box{
	background: rgba(0,0,0,.4);
	font-size: 15px!important;
    z-index: 9999;
    text-align: center;
    overflow: hidden;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}
.confirm_box>div {
    overflow: hidden;
    position: absolute;
    left: 13.5%;
    top: 50%;
    width: 73%;
    background: #fff;
    border-radius: 10px;
    text-align: center;
    vertical-align: middle;
    -webkit-transform: translateY(-50%);
    transform: translateY(-50%);
}

.confirm_box>div>h1 {
    font-size: 15px!important;
    font-style: normal;
    padding: 15px 10px 10px;
    color: #333;
}
.confirm_box> div > a {
    font-size: 16px !important;
    display: block;
    line-height: 40px;
    color: #007AFF;
    text-decoration: none;
    border-top: 1px solid #DBDCDC;
}
.confirm_box i{
	font-style: normal;
    float: left;
    width: 50%;
}
.confirm_box i:first-child {
    margin-right: -1px;
    border-right: 1px solid #DBDCDC;
}

.jubao{
	color:#696969;
	font-size: .7rem;
	position: absolute;
	right: 0;
	top:0;
	z-index: 10;
}
.jubao_box{
	display: none;
}
.jubao_box .mask{
	position: fixed;
    z-index: 1000;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}
.jubao_box .jubao_box_content{
	position: fixed;
    z-index: 5000;
    width: 16.25rem;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    background-color: #FFFFFF;
	background: #FFFFFF;
	border-radius: 8px;
}
.jubao_box .jubao_box_content_hd h4{
	font-size: 0.8rem;
	line-height: 1.1rem;
	padding: 0.55rem 0;
	color: #323232;
	letter-spacing: -0.39px;
	background: #EFEFF4;
	border-radius: 8px 8px 0 0;
	text-align: center;
}
.jubao_box .jubao_box_content_bd{
	padding: 0 0.75rem;
	border-bottom: 1px solid #EFEFEF;
}
.jubao_box_row{
	font-size: 0.8rem;
	color: #323232;
	letter-spacing: 0;
	padding: 0.5rem 0;
	border-bottom: 1px solid #EFEFEF;
}
.jubao_box_row:last-child{
	border-bottom: none;
}
.jubao_box_row span{
	float: left;
}
.jubao_box_content_ft{
	padding:  1rem 0;
}

.jb_tijiao{
	background:#696969;
	border-radius: 4px;
	width: 12.5rem;
	color: #fff;
	margin:auto;
	display:block;
	line-height: 1rem;
	font-size: 0.9rem;
	padding:  0.5rem 0;
	text-align: center;
}
.jb_btn_close{
	width: 1.5rem;
	height: 3.5rem;
	background: url(/Public/Images/img/icon_guanbi2@3x.png) no-repeat;
	background-size: 100% 100%;
	display: block;
	position: absolute;
	top:-3.5rem;
	right: 0;
}

.jubao_box_row .icon_nochoose{
	width: .85rem;
    height: .85rem;
    background: url(/Public/Images/img/icon_no_choose@3x.png) no-repeat;
    background-size: 100% 100%;
    float: right;
    margin-top: .125rem;
}
.jubao_box_row.active .icon_nochoose {
    background: url(/Public/Images/img/choose@3x.png) no-repeat;
    background-size: 100% 100%;
}


</style>
{/block}
{block name="content"}

	
<div class="com_header">
	<a href="javascript:;" class="go_back"><i class="icon_back"></i></a>{$head_title}<a class="louzhu native_go {if $see_lz}active{/if}"  href='/FrontChannel/post_detail/post_id/{$post.post_id}{if !$see_lz}/see_lz/1{/if}'>
只看楼主</a>
</div>


<div id="load_wrapper" style="margin-top: 2.2rem;margin-bottom: 2.5rem">
	<div id="scroller">
		<div id="pullDown">
		    <span class="pullDownIcon"></span>
		</div>

	<div class="user_header clearfix" >
		 <a href="/FrontUserCenter/others_space/user_id/{$post.user_id}" class="avatar native_go">
		 	<img data-src="{$post_user.headimgurl}?imageView2/1/w/200/h/200/imageslim" src="/Public/Images/img/no-img.png" alt="">
		 </a>
		 <div class="user_main clearfix">
		 	<a class="nickname native_go" data-url="/FrontUserCenter/others_space/user_id/{$post.user_id}">{$post_user.nickname}</a>
		 	{foreach from=$title_list item=v}
		 	<i class="tag" style="background-color:{$v.title_color}">{$v.title_name}</i>
		 	{/foreach}
		 </div>
		 <p style="position: relative;">{$post.addtime}<span class="type">{$channel.channel_name}</span>
			<span class="jubao">举报</span>
		 </p>
		 	
		 	 {if $del}
			 <!-- 删除 -->
			 <p class="delete" id="delete" style="color: #2C77A5;line-height: 1rem;font-size: .7rem;margin-top: .6rem;">删除本贴</p>
			 {/if}

		 {if $opt == 'crowdfunding'}
		 	{if $cf.status == CrowdfundingModel::SUCCESS}
			 <!-- 成功 -->
			 <div class="zhonchou_succ"></div>
			{elseif $cf.status == CrowdfundingModel::FAILURE}
			 <!-- 失败 -->
			 <div class="zhonchou_fail"></div>
			 {/if}
		 {/if}
	</div>

	<div class="post_content">
		<h2>{$post.title}</h2>
		<p>{$post.content}</p>
		<div class="post_imgs">
			{foreach from=$post_imgs item=v key=k}
			<img data-src="{$v}?imageMogr2/auto-orient/thumbnail/800x/imageslim" alt="" data-row="{$k}"  data-img="{$v}?imageMogr2/auto-orient/thumbnail/800x/imageslim" alt="" src="/Public/Images/img/no-img.png">
			{/foreach}
		</div>
		
		{if $opt == 'praise' && $see_hide}
		<!-- 隐藏内容 -->
		<div class="hide_content" >
			<p>
				{$praise_hide.content}
			</p>
			<div class="post_imgs">
				{foreach from=$praise_hide.hide_imgs item=img key=k}
				<img  src="/Public/Images/img/no-img.png" data-src="{$img}?imageMogr2/auto-orient/thumbnail/800x/imageslim" alt="" data-row="{$k}"  data-img="{$img}?imageMogr2/auto-orient/thumbnail/800x/imageslim" src="/Public/Images/img/no-img.png">
				{/foreach}
			</div>		
		</div>
		{/if}

	</div>

	{if $opt == 'praise'}
		{include file='./praise_detail_content.html'}
	{elseif $opt == 'reward'}
		{include file='./reward_detail_content.html'}
	{elseif $opt == 'crowdfunding'}
		{include file='./crowdfunding_detail_content.html'}
	{/if}
	

	<!-- 用户评论 -->
	<div class="user_comment">
		<h5 class="comment_title">用户评论（{$post.comment_num}）</h5>
		<div class="comment_list" id='comment_list'>
			{foreach from=$comment_list item=v}
			<div class="comment_item">
				<div class="comment_top">
					<a href="/FrontUserCenter/others_space/user_id/{$v.user_id}" class="avatar native_go">
						<img data-src="{$v.comment_user.headimgurl}?imageView2/1/w/200/h/200/imageslim" alt="" src="/Public/Images/img/no-img.png">
						{if $v.is_lz}<span class="lz_tag">楼主</span>{/if}
					</a>
					<div class="comment_user">
						<div class="user_info"><a class="nickname native_go" href="/FrontUserCenter/others_space/user_id/{$v.user_id}">{$v.comment_user.nickname}</a>
							{foreach from=$v.title_list item=title}
							<i class="tag" style="background-color:{$title.title_color}">{$title.title_name}</i>
							{/foreach}
						</div>
						<div class="other clearfix">
							<span class="floor">{$v.floor}楼</span>
							<span class="time">{$v.addtime}</span>
							<span class="zan_num">{$v.praise_num}</span>
							<i class="icon_zan {if $v.is_praise}hover{/if}" data-comment_id="{$v.post_comment_id}"></i>
							<i class="icon_pl" data-comment_id="{$v.post_comment_id}" data-nickname="{$v.comment_user.nickname}"></i>
						</div>
						<div class="text" data-comment_id="{$v.post_comment_id}" data-nickname="{$v.comment_user.nickname}">
							{$v.content}
						</div>
						<ul class="imgbox clearfix">
							{foreach from=$v.imgs item=img key=key}
							<li><img src="/Public/Images/img/no-img.png" data-src="{$img}?imageView2/1/w/200/h/200/imageslim" alt="" class="img" data-row="{$key}"  data-img="{$img}?imageMogr2/auto-orient/imageslim"></li>
							{/foreach}
						</ul>
						
						{if $opt == 'praise'}
							{include file="./praise_comment_hide.html"}
						{/if}
					</div>
				</div>
				{if $v.reply_comment_list}
				<div class="comment_cont">
					<ul>
						{foreach from=$v.reply_comment_list item=item}
						<li><span class="nick">{$item.nickname}：</span>{$item.content}</li>
						{/foreach}
					</ul>
				</div>
				{/if}
			</div>
			{/foreach}
		</div>
	</div>

		<div id="pullUp">
			<!-- <span class="pullUpIcon"> --></span><span class="pullUpLabel">上拉加载...</span>
		</div>
	</div>
</div>




<!-- 全屏图片查看器-->
<div class="swiper-container fullscreen" id="fullscreen">
	<div class="swiper-wrapper" id="swiper_wrapper">
	</div>
</div>
<!-- 普通底部 -->
<div class="fixed_footer">
	<div class="input">
		一起来补魔吧(●ˇ∀ˇ●)
	</div>
	{if $opt == 'praise' && $is_lz}
	<!-- 有楼主回帖按钮 -->
	<a class="huitie native_go" href="/FrontChannel/praise_lz_ht/post_id/{$post.post_id}">回帖</a>
	{/if}
	<i class="zan {if $post_is_praise}active{/if}"></i>
	<i class="coll {if $is_collect}active{/if}"></i>
	<i class="share" onclick="return_share();"></i>
</div>

{if $opt == 'crowdfunding'}
	{include file='./support_list.html'}
{/if}

{if $opt == 'reward'}
	{include file='./reward_refund.html'}
{/if}


<!--支付弹窗-->
<div id="pay_box" style="display: none;">
	<div class="pop_back"></div>
	<div class="pay_pop">
		<div class="recharge_detail">
			<span class="close_pay"></span>
			充值详情
		</div>

		<div class="recharge_amount">
			充值金额
			<span class="amount">0元</span>
		</div>
		<div class="interval"></div>
		<div class="choose_pay">
			<div class="title">选择支付方式</div>
			<div class="pay" data-pay_way="alipay">
				<i class="icon_pay zhifubao"></i>
				<p>支付宝支付</p>
				<span class="paymethod on"><input type="radio"   name="pay_method" value="alipay" class="radioclass" checked></span>
			</div>
			<div class="pay" data-pay_way="wx_pay">
				<i class="icon_pay weixin"></i>
				<p>微信支付</p>
				<span class="paymethod"><input type="radio"  name="pay_method" value="wx_pay" class="radioclass"></span>
			</div>
		</div>
		<input type="submit" class="confirm" value="支付" id="zhifu">
	</div>	
</div>
<!--充值弹窗-->
<div id="recharge" style="display: none;">
	<div class="pop_back"></div>
	<div class="recharge_pop">
		<div class="recharge_detail">
			<span class="close_recharge"></span>
			余额不足，需先充值
		</div>
		<div class="choose_amount">
			<p>请选择充值金额</p>
			<div class="btn_group">
				<span class="btn money" data-money="20">20元</span>
				<span class="btn active money" data-money="50">50元</span>
				<span class="btn money" data-money="100">100元</span>
				<span class="btn money" data-money="200">200元</span>
				<span class="btn money" data-money="500">500元</span>
				<span class="btn money" data-money="1000">1000元</span>
				<span class="btn money" data-money="2000">2000元</span>
				<span class="btn money zdy_money" data-money="" style="display: none"></span>
				<input type="number" placeholder="自定义" onfocus="this.placeholder='';$('.money').removeClass('active');" onblur="this.placeholder='自定义'" class="btn customize">
			</div>
		</div>
		<div class="balance">钱包余额<span style="color:#ff6600">0元</span></div>
		<input type="submit" class="confirm" style="top:0.7rem" value="充值" id="chongzhi">
	</div>
</div>
<!-- 密码 -->
<div id="pwd_box">
	<!-- <div class="pop_back"></div> -->
	<div class="pwd_pop">
		<div class="pwd_detail">
			<span class="close_pwd"></span>
			输入支付密码
		</div>
		<div class="input_box">
			<input type="tel" maxlength="6" id="pwd_ipt">
				<span class="dot dot_1"></span> 
				<span class="dot dot_2"></span> 
				<span class="dot dot_3"></span> 
				<span class="dot dot_4"></span> 
				<span class="dot dot_5"></span> 
				<span class="dot dot_6"></span> 
		</div>
		<p class="forget_pwd native_go"><a href="/FrontUserCenter/forget_pay_psw">忘记密码&nbsp;</a></p>
	</div>
</div>

{if $del || $is_jd}
<!-- 删除提示 -->
<div class="confirm_box" style="display: none;">
	<div>
		<h1>你确定要删除吗？</h1>
		<!-- <p>提示内容</p> -->
		<a><i id="confirmOk">确定</i><i id="confirmCancel">取消</i></a>
	</div>
</div>
{/if}

<!-- 举报 -->
<div class="jubao_box">
	<div class="mask"></div>
	<div class="jubao_box_content">
		<div class="jubao_box_content_hd">
			<h4>选择举报原因</h4>
		</div>
		<div class="jubao_box_content_bd">
			<div class="jubao_box_row clearfix">
				<span>广告</span><i class="icon_nochoose"></i>
			</div>
			<div class="jubao_box_row clearfix">
				<span>色情</span><i class="icon_nochoose"></i>
			</div>
			<div class="jubao_box_row clearfix">
				<span>其他</span><i class="icon_nochoose"></i>
			</div>
		</div>
		<div class="jubao_box_content_ft">
			<a href="javascript:;" class="jb_tijiao">提交</a>
		</div>
		<!-- 关闭 -->
		<div class="jb_btn_close"></div>
	</div>
</div>
{/block}
{block name="js"}
<script>
	var total = parseInt('{$total}');
    var firstRow = parseInt('{$firstRow}');
    var post_id = parseInt('{$post.post_id}');
    var praiseing = false;
    var collecting = false;
    var see_lz = parseInt('{$see_lz}');
    var item_id = 0;
    var buying = false;
    var recharge_num = 0;

    //分享的参数
	var share_title = {if $post.title}'{$post.title}'{else}'sama'{/if};
	var share_pic = '{$post_user.headimgurl}';
	console.log(share_pic)
	var desc_str = {if $share_desc}'{quotemeta($share_desc)}'{else}'帖子分享'{/if};
	var share_desc = desc_str.substr(0,30);
	var share_url = document.location.href;
</script>
<script type="text/javascript" src="__PUBLIC__/Js/front/js/lazy-load-img.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/front/iscroll.js"></script>

{if $opt == 'praise'}
<script type="text/javascript" src="__PUBLIC__/Js/front/js/praise_comment_load.js"></script>	
{else}
<script type="text/javascript" src="__PUBLIC__/Js/front/js/normal_comment_load.js"></script>	
{/if}

{if $opt == 'crowdfunding'}
<script type="text/javascript" src="__PUBLIC__/Js/front/js/cf_detail.js"></script>
<script>
	var one_support_money = parseFloat('{$cf.one_support}');
</script>
{elseif $opt == 'praise'}
<script type="text/javascript" src="__PUBLIC__/Js/front/js/praise_detail.js"></script>
{elseif $opt == 'reward'}
<script type="text/javascript" src="__PUBLIC__/Js/front/js/reward_detail.js"></script>
{/if}

<script>

{literal}
	$(function(){

		//评论
		function commitComment(data){
			var data = JSON.parse(data);  
			// alert(data);
			$('.comment_list').append(html);
		}
		//举报
		$('.jubao_box_row').on('click',function(){
			$(this).addClass('active').siblings().removeClass('active');
		})
		$('.jb_btn_close').on('click',function(){
			$('.jubao_box').hide();
		})
		$('.jubao').on('click',function(){
			$('.jubao_box').show();
		})
		$('.jb_tijiao').on('click',function(){
			$('.jubao_box').hide();
			setTimeout(function(){
				toast('举报成功','succ');
			},100)
		})
		//懒加载
		var lazyLoadImg = new LazyLoadImg({
	        el: document.querySelector('#load_wrapper'),
	        mode: 'default', //默认模式，将显示原图，diy模式，将自定义剪切，默认剪切居中部分
	        time: 250, // 设置一个检测时间间隔
	        complete: true, //页面内所有数据图片加载完成后，是否自己销毁程序，true默认销毁，false不销毁
	        position: { // 只要其中一个位置符合条件，都会触发加载机制
	          top: 0, // 元素距离顶部
	          right: 0, // 元素距离右边
	          bottom: 0, // 元素距离下面
	          left: 0 // 元素距离左边
	        },
	        before: function () { // 图片加载之前执行方法
	          
	        },
	        success: function (el) { // 图片加载成功执行方法
	          // el.classList.add('success');
	          myScroll.refresh();
	        },
	        error: function (el) { // 图片加载失败执行方法
	          // el.src = './images/error.png'
	        }
	    })
{/literal}
		{if $del}
{literal}
	    //删除
	    $('#delete').on('click',function(){
	    	$('.confirm_box').show();

	    })
	    $('#confirmOk').on('click',function(){

	    	// alert('蛤蛤蛤')
	    	$.ajax({
	    		url:'/FrontChannel/del_post',
	    		type:'post',
	    		data:{post_id:post_id},
	    		success:function(r){
	    			if(r.code == 0){
	    				tan_tishi('帖子删除成功');
	    				setTimeout(function(){
	    					native_listen('back_reload');
	    				}, 1000);
	    			}else{
	    				tan_tishi(r.msg);
	    			}
	    		}
	    	})

	    	$('.confirm_box').hide();
	    })
	    $('#confirmCancel').on('click',function(){
	    	$('.confirm_box').hide();
	    })
{/literal}	 
	    {/if}


		{if $is_jd}
{literal}
		//删除
		$('#jdelete').on('click',function(){
			$('.confirm_box').show();

		})
		$('#confirmOk').on('click',function(){

			// alert('蛤蛤蛤')
			$.ajax({
				url:'/FrontChannel/del_post',
				type:'post',
				data:{post_id:post_id},
				success:function(r){
					if(r.code == 0){
						tan_tishi('帖子删除成功');
						setTimeout(function(){
							native_listen('back_reload');
						}, 1000);
					}else{
						tan_tishi(r.msg);
					}
				}
			})

			$('.confirm_box').hide();
		})
		$('#confirmCancel').on('click',function(){
			$('.confirm_box').hide();
		})
{/literal}
		{/if}


{literal}
		// 百分比
		$('.p2').width($('.p2').attr("data-width")+"%")

		//点赞
		$('body').on('click','.icon_zan', function(){
			if(praiseing){
				return;
			}
			var obj = $(this);
			praiseing = true;
			var comment_id = $(this).data('comment_id');
			if($(this).hasClass('hover')){
				var type = 2;
			}else{
				var type = 1;
			}
			$.ajax({
				url:'/Front/praise',
				type:'post',
				data:{id:comment_id, praise_type:'comment', type:type},
				success:function(r){
					if(r.code == 0){
						if(type == 1){
							var zan_num = parseInt(obj.parent().find('.zan_num').html())+1;
							obj.parent().find('.zan_num').html(zan_num);
							obj.addClass('hover');
						}else{
							var zan_num = parseInt(obj.parent().find('.zan_num').html())-1
							obj.parent().find('.zan_num').html(zan_num);
							obj.removeClass('hover');
						}
					}else{

					}
					praiseing = false;
				}
			})
			
		})
		//图片正方形
		var liw = $('.imgbox li').width();
		$('.imgbox li').height(liw);

		//底部点赞和收藏
		$('.zan').on('click',function(){
			if(praiseing){
				return;
			}
			praiseing = true;
			var obj = $(this);
			praiseing = true;
			
			if($(this).hasClass('active')){
				var type = 2;
			}else{
				var type = 1;
			}
			$.ajax({
				url:'/Front/praise',
				type:'post',
				data:{id:post_id, praise_type:'post', type:type},
				success:function(r){
					if(r.code == 0){
						if(type == 1){
							obj.addClass('active');
						}else{
							obj.removeClass('active');
						}
					}else{

					}
					praiseing = false;
				}
			})
			// $(this).toggleClass('active');
		})
		$('.coll').on('click',function(){
			if(collecting){
				return;
			}
			var obj = $(this);
			if($(this).hasClass('active')){
				var type = 2;
			}else{
				var type = 1;
			}

			collecting = true;
			$.ajax({
				url:'/Front/collect',
				type:'post',
				data:{id:post_id, type:type},
				success:function(r){
					if(r.code == 0){
						tan_tishi(r.msg)
						obj.toggleClass('active');
					}
					collecting = false;
				}
			})
			
		})
		//全屏查看1
		$(function(){
			$(document).on('click', '.post_imgs img', function(event){
				event.preventDefault();
				var row = $(this).data('row');
				console.log
				var img_urls = [];
				console.log($(this).parent().parent())
				$(this).parent().find('img').each(function() {        
				    img_urls.push($(this).data("img"));
				});
				var html = '';
				for(i=0;i<img_urls.length;i++){
					html += '<div class="swiper-slide fullscreen_slide"><img src="'+img_urls[i]+'"/></div>';
				}
				$('#swiper_wrapper').empty().append(html);
				console.log(img_urls);
				$('#fullscreen').fadeIn();
				var full_swiper = new Swiper('.fullscreen',{
				    //pagination : '.full_pagination',
				});

				full_swiper.slideTo(row, 0, false);
				if(row==0){
					$("#swiper_wrapper").css({
						"transform": "translate3d(0px, 0px, 0px)"
					});
				}
				
			});
			// 关闭查看器
			$('#fullscreen').on('click', function(event) {
				event.preventDefault();
				$(this).fadeOut();
			});
		})

		//全屏查看2
		$(function(){
			$(document).on('click', '.img', function(event){
				event.preventDefault();
				var row = $(this).data('row');
				var img_urls = [];
				console.log($(this).parent().parent())
				$(this).parent().parent().find('.img').each(function() {        
				    img_urls.push($(this).data("img"));
				});
				var html = '';
				for(i=0;i<img_urls.length;i++){
					html += '<div class="swiper-slide fullscreen_slide"><img src="'+img_urls[i]+'"/></div>';
				}
				$('#swiper_wrapper').empty().append(html);
				console.log(img_urls);
				$('#fullscreen').fadeIn();
				var full_swiper = new Swiper('.fullscreen',{
				    //pagination : '.full_pagination',
				});
				full_swiper.slideTo(row, 0, false);
				if(row==0){
					$("#swiper_wrapper").css({
						"transform": "translate3d(0px, 0px, 0px)"
					});
				}
				
			});
			// 关闭查看器
			$('#fullscreen').on('click', function(event) {
				event.preventDefault();
				$(this).fadeOut();
			});
		})

		//微信和支付宝
		$(".pay").on("click",function(){

	  		$(this).find('.paymethod').addClass("on");
	  		$(this).find("input").prop("checked",true);
	  		$(this).siblings("div").children("input").attr("checked","false");
	  		$(this).siblings("div").children("span").removeClass("on");
	  		var val_payPlatform = $('.choose_pay input[name="pay_method"]:checked ').val();
	  		console.log(val_payPlatform);
  		})
		//购买-充值
		// $('.buy_btn').on('click',function(){
		// 	$('#recharge').show();
		// })

		//选择金额
  		$('.money').on('click',function(){
  			recharge_num = $(this).data('money')
  			$(this).addClass('active').siblings().removeClass('active');
  		})	
		//充值-关闭
  		$('#recharge .close_recharge').on('click',function(){
  			$('#recharge').hide();
  			buying = false;
  			// $('.zdy_money').html('').attr('data-money', '');
		   //  $('.money').removeClass('active');
		   //  $('.customize').val('').show();
		   //  $('.zdy_money').hide();
  		})
  		//充值
  		$('#chongzhi').on('click', function(){
  			recharge_num = $('.recharge_pop').find('.btn_group').find('.active').attr('data-money');
            if(recharge_num == ''){
                toast('请输入充值金额', 'fail');
                is_click = false;
                return;
            }

            if(recharge_num < 20){
                toast('最低充值为20元哦( • ̀ω•́ )✧', 'fail');
                is_click = false;
                return;
            }

  			console.log('recharge_num:'+recharge_num)
  			$('.amount').html(recharge_num+'元');
  			$('#recharge').hide();
  			$('#pay_box').show();
  		})
		//支付关闭
  		$('#pay_box .close_pay').on('click',function(){
  			$('#pay_box').hide();
  			buying = false;
  		})
  		//支付按钮
  		$('#zhifu').on('click',function(){
  			// alert('支付');
  			var payway = $('[name="pay_method"]:checked').val()
  			// recharge_num = $('.recharge_pop').find('.btn_group').find('.active').data('money');

  			console.log(payway);
  			console.log(recharge_num);

  			$.ajax({
				url:'/FrontUserCenter/payment',
				type:'post',
				data:{recharge_num:recharge_num, payway:payway},
				success:function(r){
					console.log(r);
					if(r.code == 0){
						native_listen(payway,{
						    parameter : r.parameter,
						});
					}else{
						layer.open({
			                content: '支付失败',
			                title: false,
			                btn: ['确定'],
			            });
					}
					buying = false;
				}
			})


  		})
  		//密码
  		$('#pwd_ipt').on('input',function(){

  			var len = $('#pwd_ipt').val().trim().length;
  			console.log(len);
  			for(var i=0;i<len;i++){
				$(".dot").eq(i).addClass('show');

			}
			for(var j=len;j<6;j++){
				$(".dot").eq(j).removeClass('show');
			}

			if(len===6){
				if(buying){
					return;
				}
				buying = true;
				var pwd = $(this).val();
				
				setTimeout(function(){
					$.ajax({
						url:'/FrontChannel/check_pwd',
						type:'post',
						data:{pwd:pwd},
						success:function(r){
							if(r.code == 1){
								toast(r.msg, 'fail');
								// tan_tishi(r.msg);
								$('#pwd_ipt').val('');
								$('.dot').removeClass('show');
								buying = false;
							}else{
{/literal}
								{if $opt == 'praise'}
								praise_buy(item_id);
								{elseif $opt == 'reward'}
								look(post_id);
								{elseif $opt == 'crowdfunding'}
								cf_buy(post_id);
								{/if}

{literal}

							}
						}
					})
				},300)

			}

  		})
  		//关闭密码
  		$('.close_pwd').on('click',function(){
  			$('#pwd_box').hide();
  			$('#pwd_ipt').val('');
  			$('.dot').removeClass('show');
  		})
  		
  		$('.customize').blur(function(){
		    var price = $(this).val();
		    if(price != ''){
		        $('.zdy_money').html(price+'元');
		        $('.zdy_money').attr('data-money', price);
		        $('.money').removeClass('active');
		        $('.customize').hide();
		        $('.zdy_money').addClass('active').show();
		        recharge_num = price;
		        console.log(recharge_num)
		    }else{
		    	$('.money').eq(0).addClass('active');
		    }
		})

		$('.zdy_money').on('click', function(){
		    $(this).hide();
		    $('.customize').show().focus();
		})
  		
	})
	
	function check_npw(price){
		var npw = false;
		$.ajax({
			url:'/FrontChannel/check_npw_pay',
			data:{price:price},
			type:'post',
			async:false,
			success:function(r){
				if(parseInt(r) == 1){
					npw = true;
				}
			}
		})
		return npw;
	}


	//发评论
	console.log(post_id);
	$('.input').on('click',function(){
		native_listen('send_comment',{
			post_id:post_id,
			comment_id:0,
			name:'',
		})
		
	})
	//回复
	$('.user_comment').on('click', '.icon_pl', function(e){
		e.stopPropagation();
		var comment_id = $(this).data('comment_id');
		var nickname = $(this).data('nickname');
		console.log(comment_id)
		native_listen('send_comment',{
			post_id:post_id,
			comment_id:comment_id,
			name:nickname,
		})
	})
	$('.user_comment').on('click', '.text', function(){
		var comment_id = $(this).data('comment_id');
		var nickname = $(this).data('nickname');
		console.log(comment_id);
		native_listen('send_comment',{
			post_id:post_id,
			comment_id:comment_id,
			name:nickname,
		})
	})
{/literal}
</script>

{/block}